<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .flex-c-c {
        display: flex;
        align-items: center;
        justify-content: center;
      }
      #grandpa {
        width: 500px;
        height: 500px;
        background-color: red;
      }
      #parent {
        width: 200px;
        height: 200px;
        background-color: orange;
      }
      #son {
        width: 100px;
        height: 100px;
        background-color: yellowgreen;
      }
    </style>
  </head>
  <body>
    <div id="grandpa" class="flex-c-c">
      <div id="parent" class="flex-c-c">
        <div id="son"></div>
      </div>
    </div>

    <script>
      var grandpa = document.getElementById('grandpa');
      var parent = document.getElementById('parent');
      var son = document.getElementById('son');
      grandpa.addEventListener('click', function () {
        console.log(1);
      });
      parent.addEventListener('click', function (event) {
        event.stopPropagation()
        console.log(2);
      },true);
      son.addEventListener('click', function () {
        console.log(3);
      });

    </script>
  </body>
</html>
